const Kao = require('koa');
const KoaBody = require('koa-body');
const static = require('koa-static');
const views = require('koa-views');
const path = require('path')


const app = new Kao();
//接受POST参数
app.use(KoaBody({
    multipart:true
}))

app.use(views(path.join(__dirname,'views/'),{extension:'ejs'}))
app.use(static(__dirname + '/public'));
//视图
const index = require('./routes/view/index')
//api
const wx = require('../server/routes/api/wx')


// app.use(async (ctx)=>{
//     ctx.body = 'sad'
// })

app.use(index.routes(),index.allowedMethods())

//使用路由
app.use(wx.routes(),wx.allowedMethods())
app.listen('3000');
console.log('启动成功')